<!--重点行业绩效评级报表 performanceRating-->
<template>
    <Layout>
        <Form ref="queryForm" :model="dataToQuery" :label-width="120">
            <Row v-show="!switchFlag" class="query-form" >
                <Col span="8">
                    <FormItem label="企业名称：" prop="orgId">
                        <cascader-dom class="query-form-el" ref='queryOrgCascader' @setOrgInfo='setQueryCompanyId'
                                      :orgTree="true"
                                      :currentOrgId="dataToQuery.companyId"
                                      :setCurrentName="{label:dataToQuery.companyName,value:dataToQuery.companyId}"></cascader-dom>
                    </FormItem>
                </Col>
                <Col span="8">
                    <FormItem label='年度：' prop='year'>
                        <DatePicker class="query-form-el" placeholder="请选择年度" v-model='dataToQuery.yearDate' type="year"></DatePicker>
                    </FormItem>
                </Col>
                <Col span="8">
                    <Button @click="reset" class="ivu-btn-reset">重置</Button>
                    <Button type="primary" class="ivu-btn-query" icon="md-search"  @click="query">查询</Button>
                </Col>
            </Row>
        </Form>
        <Table ref='table' :height="tableHeight" :row-class-name="rowClassName" no-data-text="没有查询到相关数据!" @on-selection-change = 'getSelectRows' :loading='pageStatus.loading'
               border :columns="columns1"  :data="dataTable" >
        </Table>
        <Row style="margin-right:10px;">
            <Col span="24" >
                <Page style="float: right" :total="pagedata.total" :page-size="pagedata.pageSize" @on-change="pageChange" @on-page-size-change="pageSizeChange" :page-size-opts="pageSizeArray" show-total show-sizer show-elevator />
            </Col>
        </Row>
    </Layout>
</template>

<script>
    import {Api} from '@/api/index.js'
    var cascaderDom = () => import('@/components/cascader-dom.vue');
    import pageCommonFunction from '@/components/pageCommonFunction.js'
    export default {
        name: "performanceRating",
        components:{
            cascaderDom
        },
        data(){
            return {
                ...this.createCommonDataField(),
                columns1: [
                    { title: '序号', width: 80, fixed: 'left', align: 'center', render: (h, params) => {
                            if(params.row.orgId === '-1') return h('span', "汇总");
                            return h('span', (params.index - 1) + (this.pagedata.currentPage - 1) * this.pagedata.pageSize + 1);
                    }},
                    { key:'orgName',title: '企业名称', fixed: 'left', align: 'center', minWidth:240 },
                    { key:'year',title: '年度', fixed: 'left', align: 'center', minWidth:80 },
                    { key:'industryTypeNum',title: '行业类型',  align: 'center', minWidth:100 },
                    {
                        title: '管控类型',
                        align: 'center',
                        children: [
                            { key:'a',title: 'A',  align: 'center' , minWidth:60},
                            { key:'b',title: 'B',  align: 'center', minWidth:60 },
                            { key:'c',title: 'C',  align: 'center', minWidth:60},
                            { key:'d',title: 'D',  align: 'center', minWidth:60},
                            { key:'guide',title: '引领',  align: 'center' , minWidth:80},
                            { key:'noGuide',title: '非引领',  align: 'center', minWidth:80 },
                        ]
                    },
                    {
                        title: '正面清单',
                        align: 'center',
                        children: [
                            { key:'positive1',title: '出口保障',  align: 'center', minWidth:90},
                            { key:'positive2',title: '战略新兴',  align: 'center', minWidth:90},
                            { key:'positive3',title: '民生保障',  align: 'center', minWidth:90 },
                            { key:'positive4',title: '军民融合',  align: 'center', minWidth:90  },
                            { key:'positive5',title: '协同供暖',  align: 'center', minWidth:90  },
                            { key:'positive6',title: '小微涉气',  align: 'center', minWidth:90  }
                        ]
                    },
                    {
                        title: '非评级',
                        align: 'center',
                        children: [
                            { key:'nonRating1',title: '已评级',  align: 'center', minWidth:80},
                            { key:'nonRating2',title: '未评级',  align: 'center', minWidth:80},
                            { key:'nonRating3',title: '未申报',  align: 'center', minWidth:80 },
                            { key:'nonRating4',title: '未组织',  align: 'center', minWidth:80  },
                        ]
                    },
                    { key:'ltShutdown',title: '长期停产',  align: 'center', minWidth:90 },
                ],
                tableHeight:10,
                dictMap: {},
                // api
                queryUrl:Api.statisticsEnPerformanceRating
            }
        },
        async mounted() {
            this.setTableHeight();
            this.query();
        },
        methods:{
            ...pageCommonFunction,
            deleteData(params) {
                this.deleteDateAjax(params);
            },
            rowClassName(row, index) {
                if (row.orgId === '-1') {
                    return 'table-summary-row';
                }
            },
            query() {
                if(this.dataToQuery.yearDate) {
                    this.dataToQuery.year = this.dataToQuery.yearDate.getFullYear();
                }
                this.queryAjax();
            },
            submit(name) {
                if(this.dataToView.rptPeroidDate) {
                    this.dataToView.rptPeroid = this.dataToView.rptPeroidDate.getFullYear();
                }
                this.submitAjax(name);
            },
            async beforeEditDialogOpen(data) {
                data.row.rptPeroidDate = new Date(data.row.rptPeroid + '-01-01');
            },
            createEmptyDataToAdd(){
                return {}
            }
        },
        watch:{
        },

    }
</script>

<style lang='css' scoped>
    /deep/ .ivu-table .table-summary-row {
        border-top: 1px solid #e8eaec;
        background-color: #f8f8f9;
    }

    /deep/ .ivu-table .table-summary-row td {
        border-right: 1px solid #e8eaec;
        background-color: #f8f8f9;
    }
</style>
